/**
 * 
 */
package com.hs.chd.action.search;

import java.util.ArrayList;
import java.util.List;

import com.hs.core.utils.TimeUtil;

/**
 * @author Administrator
 *
 */
public class SearchUtil {
	
	public static String getYearSelectStr(boolean selected,int range){
		StringBuffer buffer = new StringBuffer();
		int year = Integer.parseInt(TimeUtil.getCurrentYear());
		for(int i = 0;i<range;i++){
			int curryear = year -i;
			buffer.append("<option value=\"");
			buffer.append(curryear);
			buffer.append("\"");
			if(selected && i==0){
				buffer.append(" selected");
			}
			buffer.append(">");
			buffer.append(curryear);
			buffer.append("</option>"); 
		}
		return buffer.toString();
	}
	public static List getRecentyears(int range){
		List yearlist = new ArrayList();
		int year = Integer.parseInt(TimeUtil.getCurrentYear());
		for(int i = 0;i<range;i++){
			int curryear = year -i;
			yearlist.add(curryear+"");
		}
		return yearlist;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
